var r = require("../../utils/Network.js");

Component({
    properties: {
        card: {
            type: Object,
            value: {}
        },
        cardsnum: Number,
        index: Number
    },
    data: {},
    methods: {
        cardDetailTapped: function() {
            var r = JSON.stringify(this.properties.card);
            wx.navigateTo({
                url: "/pages/cardDetail/cardDetail?card=" + r + "&cardsnum=" + this.properties.cardsnum + "&navindex=3"
            });
        },
        changeCard: function() {
            var e = this;
            if (1 == this.properties.card.active) return wx.showLoading({
                title: "当前为默认卡"
            }), void setTimeout(function() {
                wx.hideLoading();
            }, 1500);
            var t = {}, a = "";
            "" == this.properties.card.cardNo ? (a = "/api/patient/switch", t = {
                idCardNo: this.properties.card.idCardNo
            }) : (a = "/api/patient/switchCard", t = {
                cardNo: this.properties.card.cardNo
            }), r.requestByHeader(a, t, "POST").then(function(r) {
                e.triggerEvent("cardchanged");
            }).catch(function(r) {
                console.log("请求失败！" + r);
            });
        }
    }
});